Skip to content

Add pico_set_modified_binary_type function #2137

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

will-v-pi
Copy link
Contributor

This adds a function to create binaries using an existing binary type & linker script, but with modified RAM/SCRATCH addresses

A similar function is already in use by the encrypted bootloader example, and picotool xip_ram_perms binary, so this extends those by adding scratch address modification

For example, to only use SRAM1 so you can power down SRAM0 in your binary you could use

pico_set_modified_binary_type(<my_exe> default RAM "0x20040000" "256k")

To create a XIP_SRAM only binary you could use

pico_set_modified_binary_type(<my_exe> no_flash
    RAM "0x13ffc000" "12k"
    SCRATCH_X "0x13fff000" "2k"
    SCRATCH_Y "0x13fff800" "2k")

The existing memmap_blocked_ram.ld could be created using

pico_set_modified_binary_type(<my_exe> default RAM "0x21000000" "256k")

Allows creating binaries using an existing binary type & linker script, but with modified RAM/SCRATCH addresses

For example, to only use SRAM1 so you can power down SRAM0 in your binary you could use `pico_set_modified_binary_type(<my_exe> no_flash RAM "0x20040000" "256k"`
@kilograham kilograham self-assigned this Jan 11, 2025
@kilograham kilograham self-requested a review January 11, 2025 19:59
@kilograham
Copy link
Contributor

kilograham commented Jan 11, 2025

this is useful functionality; we need to think about whether this is best as modifying the linker script or injecting as per FLASH_SIZE (either way it should - and i think it is for FLASH_SIZE be modifiable via linker script)

@kilograham kilograham added this to the 2.2.0 milestone Jan 31, 2025
@lurch lurch added the build label Mar 20, 2025
@lurch
Copy link
Contributor

lurch commented Mar 20, 2025

To create a XIP_SRAM only binary you could use

pico_set_modified_binary_type(<my_exe> no_flash
    RAM "0x13ffc000" "12k"
    SCRATCH_X "0x13fff000" "2k"
    SCRATCH_Y "0x13fff800" "2k")

Perhaps it would be nice if you could use symbolic aliases here, rather than having to use hardcoded addresses? 🤷

@lurch
Copy link
Contributor

lurch commented Mar 20, 2025

Maybe this is a first step towards #1547 ?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants